package cn.gson.springmvc.model.pojos;

import javax.persistence.*;
import java.util.Objects;

@Entity
public class Pandian {
    private int pdId;
    private Long pdShuliang;
    private Long pdOldshuliang;
    private Long pdKuisunshuliang;
    private Long pdKuisunmoney;
    private Long pdAllmoney;
    private String pdPeople;
    private String pdDate;
    private Inventory inventoryByInventoryNumber;

    @Id
    @Column(name = "pd_id", nullable = false)
    public int getPdId() {
        return pdId;
    }

    public void setPdId(int pdId) {
        this.pdId = pdId;
    }

    @Basic
    @Column(name = "pd_shuliang", nullable = true, precision = 0)
    public Long getPdShuliang() {
        return pdShuliang;
    }

    public void setPdShuliang(Long pdShuliang) {
        this.pdShuliang = pdShuliang;
    }

    @Basic
    @Column(name = "pd_oldshuliang", nullable = true, precision = 0)
    public Long getPdOldshuliang() {
        return pdOldshuliang;
    }

    public void setPdOldshuliang(Long pdOldshuliang) {
        this.pdOldshuliang = pdOldshuliang;
    }

    @Basic
    @Column(name = "pd_kuisunshuliang", nullable = true, precision = 0)
    public Long getPdKuisunshuliang() {
        return pdKuisunshuliang;
    }

    public void setPdKuisunshuliang(Long pdKuisunshuliang) {
        this.pdKuisunshuliang = pdKuisunshuliang;
    }

    @Basic
    @Column(name = "pd_kuisunmoney", nullable = true, precision = 0)
    public Long getPdKuisunmoney() {
        return pdKuisunmoney;
    }

    public void setPdKuisunmoney(Long pdKuisunmoney) {
        this.pdKuisunmoney = pdKuisunmoney;
    }

    @Basic
    @Column(name = "pd_allmoney", nullable = true, precision = 0)
    public Long getPdAllmoney() {
        return pdAllmoney;
    }

    public void setPdAllmoney(Long pdAllmoney) {
        this.pdAllmoney = pdAllmoney;
    }

    @Basic
    @Column(name = "pd_people", nullable = true, length = 30)
    public String getPdPeople() {
        return pdPeople;
    }

    public void setPdPeople(String pdPeople) {
        this.pdPeople = pdPeople;
    }

    @Basic
    @Column(name = "pd_date", nullable = true, length = 30)
    public String getPdDate() {
        return pdDate;
    }

    public void setPdDate(String pdDate) {
        this.pdDate = pdDate;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Pandian pandian = (Pandian) o;
        return pdId == pandian.pdId &&
                Objects.equals(pdShuliang, pandian.pdShuliang) &&
                Objects.equals(pdOldshuliang, pandian.pdOldshuliang) &&
                Objects.equals(pdKuisunshuliang, pandian.pdKuisunshuliang) &&
                Objects.equals(pdKuisunmoney, pandian.pdKuisunmoney) &&
                Objects.equals(pdAllmoney, pandian.pdAllmoney) &&
                Objects.equals(pdPeople, pandian.pdPeople) &&
                Objects.equals(pdDate, pandian.pdDate);
    }

    @Override
    public int hashCode() {
        return Objects.hash(pdId, pdShuliang, pdOldshuliang, pdKuisunshuliang, pdKuisunmoney, pdAllmoney, pdPeople, pdDate);
    }

    @ManyToOne
    @JoinColumn(name = "inventory_number", referencedColumnName = "inventory_number")
    public Inventory getInventoryByInventoryNumber() {
        return inventoryByInventoryNumber;
    }

    public void setInventoryByInventoryNumber(Inventory inventoryByInventoryNumber) {
        this.inventoryByInventoryNumber = inventoryByInventoryNumber;
    }
}
